#ifndef __BTL_FINGERPRINT_FLASH_H__
#define __BTL_FINGERPRINT_FLASH_H__
#include "btl_config.h"
#include "sdfile.h"
#include "fs.h"
typedef enum _FLASH_ERASER {
    CHIP_ERASER,
    BLOCK_ERASER, //64k
    SECTOR_ERASER,//4k
    PAGE_ERASER,  //256B
} FLASH_ERASER;

#define FLASH_SECTOR_SIZE (4 * 1024)
#define FP_FLASH_DIR SDFILE_APP_ROOT_PATH"USERIF"

typedef struct __tplt_addr_to_vfs
{
    unsigned int vfs_start_addr;  // 1
} addr2vfs;

struct fp_flash_info {
    SDFILE* fp_handle;
    addr2vfs addr;
    struct vfs_attr attr;
};

struct fp_flash_info* fp_flash(void);

int fp_flash_is_xip_accessible(unsigned int flash_addr, unsigned int len);
// int fp_flash_invalidate(unsigned int flash_addr, unsigned int len);
int fp_flash_erase(unsigned int addr, unsigned int size);
int fp_flash_write(unsigned int addr, const unsigned char *data, unsigned int len);
int fp_flash_read(unsigned int addr, unsigned int size, unsigned char *buf);

#endif /* __BTL_FINGERPRINT_FLASH_H__ */
